#include "config.h"

void readConfig(const char* filename,HashTable* ht){
    FILE* fp = fopen(filename,"rw");
    if(fp==NULL){
        printf("open file %s error.\n",filename);
        return;
    }

    char buff[20]={0};
    while(fgets(buff,sizeof(buff),fp)!=NULL){
        char* strs[3]={0};
        int cnt=0;
        splitString(buff,"=",strs,3,&cnt);
        char* value =(char*) calloc(1,strlen(strs[1])+1);
        strcpy(value,strs[1]);
        insert(ht,strs[0],value);
        freeStrs(strs,cnt);
    }
    fclose(fp);
}
